Skip to content

docs(reference/QueryClient): clarify query client query methods#10725

Merged
TkDodo merged 2 commits into
TanStack:mainfrom
0Jaemin0:docs/query-client-method-notes
May 22, 2026
Merged

docs(reference/QueryClient): clarify query client query methods#10725
TkDodo merged 2 commits into
TanStack:mainfrom
0Jaemin0:docs/query-client-method-notes

Conversation

@0Jaemin0
Copy link
Copy Markdown
Contributor

@0Jaemin0 0Jaemin0 commented May 18, 2026

🎯 Changes

Clarifies the differences between queryClient.invalidateQueries, queryClient.refetchQueries, and queryClient.removeQueries in the QueryClient reference docs.

These methods can look similar because they all match queries by filters, so this adds short Notes explaining whether each method invalidates, refetches, keeps, or removes matching queries.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Documentation
    • Clarified QueryClient reference with a new Notes section for three query-management methods:
      • invalidateQueries — now explains it marks matching queries as invalidated and then refetches active queries (unless overridden).
      • refetchQueries — clarifies it refetches all matching queries without prior invalidation.
      • removeQueries — clarifies it removes matching queries from the cache instead of refetching.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: abae8fd9-efaa-47e2-970f-b466005c39db

📥 Commits

Reviewing files that changed from the base of the PR and between 4f203aa and 0d43c1d.

📒 Files selected for processing (1)
  • docs/reference/QueryClient.md

📝 Walkthrough

Walkthrough

Documentation for three QueryClient methods was updated with clarifying "Notes" sections. invalidateQueries notes explain it invalidates and refetches per refetchType while keeping queries in cache. refetchQueries notes clarify it refetches without prior invalidation. removeQueries notes specify it removes queries from cache instead of refetching.

Changes

QueryClient method documentation clarifications

Layer / File(s) Summary
QueryClient method behavior notes
docs/reference/QueryClient.md
Added "Notes" sections to invalidateQueries, refetchQueries, and removeQueries distinguishing their behavior: invalidation + refetch with cache retention, refetch-only, and cache removal respectively.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • TanStack/query#10725: Updates docs/reference/QueryClient.md with the same "Notes" clarification bullets for invalidateQueries, refetchQueries, and removeQueries.

Poem

🐰 I hopped through docs with nimble paws,
Adding notes to clarify the laws.
invalidate marks, then refetches the live,
refetch just runs — no invalidate dive.
remove clears cache so old data won't thrive.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding clarification notes to the QueryClient reference documentation for three query methods.
Description check ✅ Passed The pull request description follows the template structure with all required sections completed, including Changes, Checklist, and Release Impact.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@0Jaemin0 0Jaemin0 changed the title docs(reference): clarify query client query methods docs(reference/QueryClient): clarify query client query methods May 18, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 18, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 4f203aa

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ❌ Failed 1m 53s View ↗
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 18s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-18 17:59:57 UTC

Comment thread docs/reference/QueryClient.md Outdated
Comment thread docs/reference/QueryClient.md Outdated
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
@TkDodo TkDodo merged commit 98fd431 into TanStack:main May 22, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants